package com.itheima.stream;

import java.util.ArrayList;
import java.util.List;

public class StreamDemo01 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("zhangsan", "zhangsi", "zhaoliu", "wangwu"));
        list.stream().filter(s -> s.startsWith("z")).filter(s -> s.length() == 7).forEach(s -> System.out.println(s));
        System.out.println("----------------------------");
        ArrayList<String> list1 = new ArrayList<>();
        for (String s : list) {
            if (s.startsWith("z")){
                list1.add(s);
            }
        }
        for (String s : list1) {
            System.out.println(s);
        }
    }
}
